{extend name="default/base" /}
{block name="css"}
<style>
.notice{padding: 3px 6px;color: #e55454}
.notice_icon{vertical-align: text-bottom;}
#deliverForm{margin:1rem;}
.delivery_good img{width:50px;height:50px;margin:10px;}
.goods_info{border: 1px solid #f1f1f1;}
.goods_info tr:nth-child(1){background: #F3F7FD;}
.goods_info tr td{text-align: center;}
label{font-weight: normal;;margin-right:15px;}
</style>
{/block}
{block name="main"}
  <div class='wst-toolbar'>
     <input type='text' class="s-ipt" id='orderNo' placeholder='订单号'/> 
     <select name="payType" id="payType" class="s-ipt">
                <option value="-1">支付方式</option>
                <option value="0">货到付款</option>
                <option value="1">在线支付</option>
               </select>

     <select name="deliverType" id="deliverType" class="s-ipt">
                <option value="-1">配送方式</option>
                <option value="0">送货上门</option>
                <option value="1">自提</option>
               </select>

      <a class="btn btn-primary" onclick="waitDivleryByPage()"><i class="fa fa-search"></i>查询</a>
      <a class="btn btn-primary" style="float:right;" onclick="javascript:toExport(2,0,'')"><i class="fa fa-sign-out"></i>导出</a>
  </div>
  <div class='wst-grid'>
    <table class='wst-order-list'>
       <thead>
	      <tr class='head'>
	         <th class="th-padding">订单详情</th>
	         <th width="115">支付方式/配送信息</th>
	         <th style="text-align: center;">金额</th>
	         <th width="110" style="text-align: center;">操作</th>
	      </tr>
	   </thead>
	   <tbody id='loadingBdy'>
	       <tr id='loading' class='empty-row' style='display:none'>
	            <td colspan='4'><img src="__SHOP__/img/loading.gif">正在加载数据...</td>
	       </tr>
       </tbody>
       <script id="tblist" type="text/html">
       {{# for(var i = 0; i < d.length; i++){ }}
       <tbody class="j-order-row">
        <tr>
           <td class='order-head'>
                  <div class='time'>{{d[i].createTime}}</div>
                  <div class='orderno'>订单号：{{d[i].orderNo}}
                    {{# if(d[i].orderSrc==0){ }}<i class="order-pc"></i>
                    {{# }else if(d[i].orderSrc==1){ }}<i class="order-wx"></i>
                    {{# }else if(d[i].orderSrc==2){ }}<i class="order-mo"></i>
                    {{# }else if(d[i].orderSrc==3){ }}<i class="order-app"></i>
                    {{# }else if(d[i].orderSrc==4){ }}<i class="order-ios"></i>
                    {{# }else if(d[i].orderSrc==5){ }}<i class="order-weapp"></i>
                    {{# } }}
                    {{# if(d[i].orderCodeTitle!=""){ }}
                      <span class="order_from">{{d[i].orderCodeTitle}}</span>
                    {{# } }}
                    {{# if(d[i].noticeDeliver==1){ }}
                    <span class="notice">
                      <img class="notice_icon" src="__SHOP__/img/nocite_deliver.png" alt="发货提醒" width="20" height="20" />
                      尽快发货
                    </span>
                    {{# } }}
                  </div>
           </td>
           <td></td>
           <td></td>
           <td><div style="text-align:center;">{{d[i].status}}</div></td>
         </tr>
         {{# 
          var tmp = null,rows = d[i]['list'].length;
          for(var j = 0; j < d[i]['list'].length; j++){
             tmp = d[i]['list'][j]; 
         }}

         <tr class='goods-box'>
            <td>
              
               <div class='goods-img'>
                <a href="{{WST.U('home/goods/detail','goodsId='+tmp.goodsId)}}" target='_blank'>
                    <span class='weixin'><img class='img gImg' title='{{tmp.goodsName}}' style='height:40px;width:40px;' data-original='__RESOURCE_PATH__/{{tmp.goodsImg}}'><img class='imged' style='height:200px;width:200px;max-width: 200px;max-height: 200px; background: #fff;' title='{{tmp.goodsName}}' src="__RESOURCE_PATH__/{{tmp.goodsImg}}"></span>
                </a>
               </div>

               <div class='goods-name'>
                 <div>{{tmp.goodsName}}</div>
                 <div>{{tmp.goodsSpecNames}}</div>
               </div>
               <div class='goods-extra'>{{tmp.goodsPrice}} x {{tmp.goodsNum}}</div>
            </td>
            {{# if(j==0){ }}
            <td rowspan="{{rows}}">
                <div style="text-align: center;">{{d[i].payTypeName}}</div>
                <div style="text-align: center;">{{d[i].deliverTypeName}}</div>
            </td>
            <td rowspan="{{rows}}">
                <div>商品金额：<span style="color: red">¥{{d[i].goodsMoney}}</span></div>
                <div class='line'>运费：<span style="color: red">¥{{d[i].deliverMoney}}</span></div>
                <div>实付金额：<span style="color: red">¥{{d[i].realTotalMoney}}</span></div>
            </td>
            <td rowspan="{{rows}}">
                <div style="text-align: center;"><a href='#none' onclick='javascript:deliver({{d[i].orderId}},{{d[i].deliverType}})'>【发货】</a></div>
                <div style="text-align: center;"><a target='blank' href='{{WST.U("shop/orders/orderPrint","id="+d[i].orderId)}}'>【打印订单】</a></div>
                <div style="text-align: center;"><a href='#none' onclick="view({{d[i].orderId}},'waitDelivery')">【订单详情】</a></div>
            </td>
            {{#}}}
         </tr>
         {{# } }}
         {{# if(WST.blank(d[i].orderRemarks)!=''){  }}
         <tr>
          <td colspan="4">
            
               <div class="order_remaker">【用户留言】{{d[i].orderRemarks}}</div>
            
          </td>
         </tr>
          {{# }  }}
         <tr class='empty-row' style="border: 0px;">
            <td colspan='4'>&nbsp;</td>
         </tr>
       </tbody>
       {{# } }}
       </script>
       <tr class='empty-row' style="border: 0px;">
            <td colspan='4' id='pager' align="center" style='padding:5px 0px 5px 0px'>&nbsp;</td>
       </tr>
    </table>
    <div id='deliverBox' style='display:none'>
       <form id='deliverForm' autocomplete='off'>
        <table class='wst-form wst-box-top goods_info' border="1" >
           <tr>
            <td class='delivery_select'><input type='checkbox' onclick="javascript:WST.checkChks(this,'.chk')"/></td>
            <td>图片</td><td width=500>商品</td><td>数量</td><td>状态</td>
          </tr>
          <tbody id='goods_info'></tbody>
        </table>
       <table class='wst-form wst-box-top'>
           <tr>
               <th width='80'>发货方式：</th>
               <td>
                  <label>
                   <input type='radio'  name='delivery_type' value='0' >无需物流</input>
                   </label>
                   <label> 
                   <input type='radio'  name='delivery_type' checked value='1' >需要物流</input>
                  </label>
               </td>
           </tr>
           <tr class="deliver_express">
            <th width='80'>快递公司：</th>
                <td>
                   <select id='expressId'>
                      <option value=''>请选择</option>
                      {volist name="$express" id='vo'}
                      <option value='{$vo["expressId"]}'>{$vo["expressName"]}</option>
                      {/volist}
                   </select>
                </td>
          </tr>
          <tr class="deliver_express">
                <th>快递号：</th>
                <td><input type='text' id='expressNo' maxLength='20' style='width:80%'></td>
           </tr>
           <tr>
               <th>收货人：</th>
               <td class="user_name"></td>
           </tr>
           <tr>
               <th>收货地址：</th>
               <td class="user_address"></td>
           </tr>
           <tr>
               <th>联系电话：</th>
               <td class="user_phone"></td>
           </tr>
       </table>
       </form>
    </div>
    <div id='editMoneyBox' style='display:none'>
       <form id='newOrderForm' autocomplete='off'>
       <table class='wst-form wst-box-top'>
          <tr>
            <th width='120'>订单号：</th>
            <td><span id='m_orderNo'></span></td>
          </tr>
          <tr>
            <th>商品总价格：</th>
            <td>¥<span id='m_goodsMoney'></span></td>
          </tr>
          <tr>
            <th>运费：</th>
            <td>¥<span id='m_deliverMoney'></span></td>
          </tr>
          <tr>
            <th>商品总价格：</th>
            <td>¥<span id='m_totalMoney'></span></td>
          </tr>
           <tr>
            <th>实际支付价格：</th>
            <td>¥<span id='m_realTotalMoney' class='j-warn-order-money'></span></td>
          </tr>
          <tr>
            <th>新价格：</th>
            <td><input type='text' id='m_newOrderMoney' maxLength='10' style='width:150px' onkeyup="javascript:WST.isChinese(this,1)" onkeypress="return WST.isNumberdoteKey(event,true)" onblur='javascript:WST.limitDecimal(this,2)'></td>
          </tr>
       </table>
       </form>
    </div>
  </div>
{/block}
{block name="js"}
<script type="text/javascript" src="__STATIC__/js/jquery.min.js?v={$v}"></script>
<script type="text/javascript" src="__STATIC__/plugins/layer/layer.js?v={$v}"></script>
<script type='text/javascript' src='__ROOT__/static/plugins/lazyload/jquery.lazyload.min.js?v={$v}'></script>
<script type='text/javascript' src='__SHOP__/orders/orders.js?v={$v}'></script>
<script>
$(function(){
	waitDivleryByPage({$p});
    $("input[name='delivery_type']").change(function() {
        if (this.value == 1) {
            $('.deliver_express').show();
        }else{
            $('.deliver_express').hide();
        }
    });
})
</script>
{/block}
